
include_directories( ${CMAKE_SOURCE_DIR}/3dPart/glfw/include )


IF(MSVC)
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /ENTRY:mainCRTStartup ")
ENDIF(MSVC)

add_executable(wave WIN32 MACOSX_BUNDLE
	wave.c
	)
add_executable(gears WIN32 MACOSX_BUNDLE
	gears.c
	)
add_executable(lianxi WIN32 MACOSX_BUNDLE
	lianxi.cpp
	)

target_link_libraries(wave glfw)
target_link_libraries(gears glfw)
target_link_libraries(lianxi glfw)


if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
       FIND_LIBRARY(CARBON_LIBRARY Carbon)
       FIND_LIBRARY(APPLICATION_SERVICES_LIBRARY ApplicationServices)
       FIND_LIBRARY(AGL_LIBRARY AGL)
       FIND_LIBRARY(OPENGL_LIBRARY OpenGL)
       target_link_libraries(wave 
              ${CARBON_LIBRARY} ${APPLICATION_SERVICES_LIBRARY} ${AGL_LIBRARY} ${OPENGL_LIBRARY})
       target_link_libraries(gears 
              ${CARBON_LIBRARY} ${APPLICATION_SERVICES_LIBRARY} ${AGL_LIBRARY} ${OPENGL_LIBRARY})
       target_link_libraries(lianxi 
              ${CARBON_LIBRARY} ${APPLICATION_SERVICES_LIBRARY} ${AGL_LIBRARY} ${OPENGL_LIBRARY})
endif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")

if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
       target_link_libraries(wave GL GLU )
       target_link_libraries(gears GL GLU )
       target_link_libraries(lianxi GL GLU )
endif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")

if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
       target_link_libraries(wave OpenGL32 GlU32 )
       target_link_libraries(gears OpenGL32 GlU32 )
       target_link_libraries(lianxi OpenGL32 GlU32 )
endif(${CMAKE_SYSTEM_NAME} MATCHES "Windows")


install(TARGETS wave DESTINATION ${CMAKE_SOURCE_DIR}/bin/ )
install(TARGETS gears DESTINATION ${CMAKE_SOURCE_DIR}/bin/ )
install(TARGETS lianxi DESTINATION ${CMAKE_SOURCE_DIR}/bin/ )
